package cn.ad.server.web.spring.model.sts;

import cn.ad.server.web.spring.model.AdResponse;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Server2Server协议请求响应类
 * @author dongbin.yu
 * @from 2016-05-20
 * @since V1.0
 */
public class STSAdResponse extends AdResponse {

	/**
	 * 协议版本号
	 */
    private float version;

    /**
     * 响应状态
     */
    private int status;

    /**
     * 响应结果提示消息
     */
    private String message;

    /**
     * 响应结果广告数据
     */
    private AdResponseData data;

    @JsonProperty("extend_data")
    private String extendData;

    public static class AdResponseData {

        @JsonProperty("adspace")
        private AdSpace[] adSpace;

        public AdSpace[] getAdSpace() {
            return adSpace;
        }

        public void setAdSpace(AdSpace[] adSpace) {
            this.adSpace = adSpace;
        }

    }

    public AdResponseData getData() {
        return data;
    }

    public void setData(AdResponseData data) {
        this.data = data;
    }

    public float getVersion() {
        return version;
    }

    public void setVersion(float version) {
        this.version = version;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getExtendData() {
        return extendData;
    }

    public void setExtendData(String extendData) {
        this.extendData = extendData;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public static class AdSpace {

        private long aid;

        @JsonProperty("adformat")
        private int adFormat;

        private Creative[] creative;

        public long getAid() {
            return aid;
        }

        public void setAid(long aid) {
            this.aid = aid;
        }

        public int getAdFormat() {
            return adFormat;
        }

        public void setAdFormat(int adFormat) {
            this.adFormat = adFormat;
        }

        public Creative[] getCreative() {
            return creative;
        }

        public void setCreative(Creative[] creative) {
            this.creative = creative;
        }
    }

    public static class Creative {

        private long cid;

        private Boolean is_html;

        @JsonProperty("html_snippet")
        private String htmlSnippet;

        private int index;

        private Banner banner;

        private Video video;

        @JsonProperty("ad_native")
        private AdNative[] adNative;

        private App app;

        private String[] impression;

        private String[] click;

        private Tracking[] tracking;

        private Event[] event;

        private String admark;

        public String getAdmark() {
            return admark;
        }

        public void setAdmark(String admark) {
            this.admark = admark;
        }

        public long getCid() {
            return cid;
        }

        public void setCid(long cid) {
            this.cid = cid;
        }

        public int getIndex() {
            return index;
        }

        public void setIndex(int index) {
            this.index = index;
        }

        public Banner getBanner() {
            return banner;
        }

        public void setBanner(Banner banner) {
            this.banner = banner;
        }

        public Video getVideo() {
            return video;
        }

        public void setVideo(Video video) {
            this.video = video;
        }

        public AdNative[] getAdNative() {
            return adNative;
        }

        public void setAdNative(AdNative[] adNative) {
            this.adNative = adNative;
        }

        public App getApp() {
            return app;
        }

        public void setApp(App app) {
            this.app = app;
        }

        public String[] getImpression() {
            return impression;
        }

        public void setImpression(String[] impression) {
            this.impression = impression;
        }

        public String[] getClick() {
            return click;
        }

        public void setClick(String[] click) {
            this.click = click;
        }

        public Tracking[] getTracking() {
            return tracking;
        }

        public void setTracking(Tracking[] tracking) {
            this.tracking = tracking;
        }

        public Event[] getEvent() {
            return event;
        }

        public void setEvent(Event[] event) {
            this.event = event;
        }

        public Boolean getIs_html() {
            return is_html;
        }

        public void setIs_html(Boolean is_html) {
            this.is_html = is_html;
        }

        public String getHtmlSnippet() {
            return htmlSnippet;
        }

        public void setHtmlSnippet(String htmlSnippet) {
            this.htmlSnippet = htmlSnippet;
        }

    }


    public static class Banner {

        private int width;

        private int height;

        private String type;

        @JsonProperty("creative_url")
        private String creativeUrl;

        public int getWidth() {
            return width;
        }

        public void setWidth(int width) {
            this.width = width;
        }

        public int getHeight() {
            return height;
        }

        public void setHeight(int height) {
            this.height = height;
        }

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getCreativeUrl() {
            return creativeUrl;
        }

        public void setCreativeUrl(String creativeUrl) {
            this.creativeUrl = creativeUrl;
        }
    }


    public static class Video {

        private int width;

        private int height;

        private String type;

        private int duration;

        @JsonProperty("creative_url")
        private String creativeUrl;

        public int getWidth() {
            return width;
        }

        public void setWidth(int width) {
            this.width = width;
        }

        public int getHeight() {
            return height;
        }

        public void setHeight(int height) {
            this.height = height;
        }

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public int getDuration() {
            return duration;
        }

        public void setDuration(int duration) {
            this.duration = duration;
        }

        public String getCreativeUrl() {
            return creativeUrl;
        }

        public void setCreativeUrl(String creativeUrl) {
            this.creativeUrl = creativeUrl;
        }
    }

    public static class AdNative {

        @JsonProperty("template_id")
        private int templateId;

        private int index;

        @JsonProperty("index_value")
        private String indexValue;

        @JsonProperty("required_field")
        private int requiredField;

        @JsonProperty("action_type")
        private int actionType;

        @JsonProperty("action_value")
        private String actionValue;

        @JsonProperty("required_value")
        private String requiredValue;

        private String type;

        public String getIndexValue() {
            return indexValue;
        }

        public void setIndexValue(String indexValue) {
            this.indexValue = indexValue;
        }

        public String getActionValue() {
            return actionValue;
        }

        public void setActionValue(String actionValue) {
            this.actionValue = actionValue;
        }

        public int getTemplateId() {
            return templateId;
        }

        public void setTemplateId(int templateId) {
            this.templateId = templateId;
        }

        public int getIndex() {
            return index;
        }

        public void setIndex(int index) {
            this.index = index;
        }

        public int getRequiredField() {
            return requiredField;
        }

        public void setRequiredField(int requiredField) {
            this.requiredField = requiredField;
        }

        public int getActionType() {
            return actionType;
        }

        public void setActionType(int actionType) {
            this.actionType = actionType;
        }

        public String getRequiredValue() {
            return requiredValue;
        }

        public void setRequiredValue(String requiredValue) {
            this.requiredValue = requiredValue;
        }

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }
    }

    public static class App {

        @JsonProperty("app_name")
        private String appName;

        @JsonProperty("app_package")
        private String appPackage;

        @JsonProperty("app_category")
        private String appCategory;

        @JsonProperty("app_size")
        private int appSize;

        public String getAppName() {
            return appName;
        }

        public void setAppName(String appName) {
            this.appName = appName;
        }

        public String getAppPackage() {
            return appPackage;
        }

        public void setAppPackage(String appPackage) {
            this.appPackage = appPackage;
        }

        public String getAppCategory() {
            return appCategory;
        }

        public void setAppCategory(String appCategory) {
            this.appCategory = appCategory;
        }

        public int getAppSize() {
            return appSize;
        }

        public void setAppSize(int appSize) {
            this.appSize = appSize;
        }
    }

    public static class Tracking {

        @JsonProperty("tracking_key")
        private int trackingKey;

        @JsonProperty("tracking_vlaue")
        private String[] trackingValue;

        public int getTrackingKey() {
            return trackingKey;
        }

        public void setTrackingKey(int trackingKey) {
            this.trackingKey = trackingKey;
        }

        public String[] getTrackingValue() {
            return trackingValue;
        }

        public void setTrackingValue(String[] trackingValue) {
            this.trackingValue = trackingValue;
        }
    }

    public static class Event {

        @JsonProperty("event_key")
        private int eventKey;

        @JsonProperty("event_value")
        private String eventValue;

        public int getEventKey() {
            return eventKey;
        }

        public void setEventKey(int eventKey) {
            this.eventKey = eventKey;
        }

        public String getEventValue() {
            return eventValue;
        }

        public void setEventValue(String eventValue) {
            this.eventValue = eventValue;
        }
    }
}
